package cn.vic.genertor.view.ui;


import cn.vic.config.model.DatabaseElement;
import cn.vic.enums.ViewTypeEnum;

import javax.swing.*;
import java.io.Serializable;

public class TreeNodeData implements Serializable {

    private static final long serialVersionUID = 6843072103831482105L;

    private String text;

    private ImageIcon icon;

    private String type;

    private String dataBase;

    private DatabaseElement databaseElement;

    private boolean open;

    public TreeNodeData(String text, ImageIcon icon, String type) {
        this.text = text;
        this.icon = icon;
        this.type = type;
    }

    public TreeNodeData(String text, ImageIcon icon, String type, DatabaseElement databaseElement) {
        this.text = text;
        this.icon = icon;
        this.type = type;
        this.databaseElement = databaseElement;
    }

    public TreeNodeData(String text, ViewTypeEnum typeEnum, DatabaseElement databaseElement) {
        this.text = text;
        this.icon = typeEnum.getImageIcon();
        this.type = typeEnum.getType();
        this.databaseElement = databaseElement;
    }

    public String getText() {
        return text;
    }

    public void setText(String text) {
        this.text = text;
    }

    public ImageIcon getIcon() {
        return icon;
    }

    public void setIcon(ImageIcon icon) {
        this.icon = icon;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public DatabaseElement getDatabaseElement() {
        return databaseElement;
    }

    public void setDatabaseElement(DatabaseElement databaseElement) {
        this.databaseElement = databaseElement;
    }

    @Override
    public String toString() {
        return text;
    }

    public String getDataBase() {
        return dataBase;
    }

    public void setDataBase(String dataBase) {
        this.dataBase = dataBase;
    }

    public boolean isOpen() {
        return open;
    }

    public void setOpen(boolean open) {
        this.open = open;
    }
}
